#!/usr/bin/env python

import sys
import pandas as pd
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt

tsv_path = sys.argv[1]

df = pd.read_csv(tsv_path,
                 sep='\t',
                 names=[
                     'timestamp',
                     'ask_diff',
                     'bid_diff',
                     'ask_basis',
                     'bid_basis',
                     'ask_1s',
                     'bid_1s',
                     'ask_1m',
                     'bid_1m'
                 ],
                 parse_dates=True)
df['timestamp'] = pd.to_datetime(df['timestamp'])
df = df.set_index('timestamp')
df['ask_edge'] = df['ask_basis'] + 20
df['bid_edge'] = df['bid_basis'] - 20

plt.figure(figsize=(100, 50))
plt.plot(df)
plt.legend([
    'ask_diff',
    'bid_diff',
    'ask_basis',
    'bid_basis',
    'ask_1s',
    'bid_1s',
    'ask_1m',
    'bid_1m',
    'ask_edge',
    'bid_edge'
])
plt.savefig('output.png')
